
//
//  UIView+Extension.swift
//  YHWeibo
//
//  Created by 昱含 on 16/6/1.
//  Copyright © 2016年 YuHan. All rights reserved.
//

import UIKit

extension UIView {
    //查找视图对象的响应者链条中的导航视图控制器
    
    func  findNavController() -> UINavigationController? {
        
        var next = self.nextResponder()
        while next != nil {
            if let nextobj = next as? UINavigationController {
                
                return
            }
            
            next = next?.nextResponder()
            
        }
        
    }
}
